package com.xyht.sca_s.student_manage_system.modules.user.controller;


import com.xyht.sca_s.student_manage_system.common.commonReturn.ResponseResult;
import com.xyht.sca_s.student_manage_system.common.desEncodeAndDecode.annotation.SecretBody;
import com.xyht.sca_s.student_manage_system.modules.user.entity.req.SmsApplicationTypeReq;
import com.xyht.sca_s.student_manage_system.modules.user.entity.req.SmsApplicationUpdateReq;
import com.xyht.sca_s.student_manage_system.modules.user.service.SmsApplicationTypeService;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 应用类型管理 前端控制器
 * </p>
 *
 * @author XYHT
 * @since 2023-04-17
 */
@RestController
@RequestMapping("/applicationType")
@SecretBody
public class SmsApplicationTypeController {
    @Autowired
    private SmsApplicationTypeService smsApplicationTypeService;

    @ApiModelProperty(value = "添加分类")
    @PostMapping("/add")
    public ResponseResult addApplicationType (@RequestBody SmsApplicationTypeReq applicationTypeReq) {
        return smsApplicationTypeService.addApplicationType(applicationTypeReq);
    }

    @ApiModelProperty(value = "修改分类")
    @PostMapping("/update")
    public ResponseResult updateApplicationType (@RequestBody SmsApplicationTypeReq applicationTypeReq) {
        return smsApplicationTypeService.updateApplicationType(applicationTypeReq);
    }

    @ApiModelProperty(value = "删除分类")
    @PostMapping("/delete")
    public ResponseResult deleteApplicationType (@RequestBody SmsApplicationTypeReq applicationTypeReq) {
        return smsApplicationTypeService.deleteApplicationType(applicationTypeReq);
    }

    @ApiModelProperty(value = "获取分类列表")
    @GetMapping("/list")
    public ResponseResult getRoleList(@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                                      @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                      @RequestParam("search_str") String search_str){
        return smsApplicationTypeService.getApplicationType(search_str,pageNum,pageSize);
    }


}

